/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#ifndef INCLUDE_SHADER_STD
#define INCLUDE_SHADER_STD



#define DEF_PBF_GroupSize		1024
#define DEF_PBF_SplashNum		5

/******************************** 采样参数 ***********************************/
#define DEF_UI_Sample_Num     16

//UI纹理层总数量
#define DEF_UI_LayerNum       16
//UI层分区域总数量
#define DEF_UI_LayerAreaNum   (8 * DEF_UI_LayerNum)



#define DEF_ShaderAttrLayout_Point     0
#define DEF_ShaderAttrLayout_Face      1
#define DEF_ShaderAttrLayout_Instance  2







#define DEF_Dir_pX	0
#define DEF_Dir_nX	1
#define DEF_Dir_pY	2
#define DEF_Dir_nY	3
#define DEF_Dir_pZ	4
#define DEF_Dir_nZ	5


#define DEF_binding_L1_3D_Tranform       1
#define DEF_binding_L1_3D_ObColor        2



#define DEF_binding_RectColor     1
#define DEF_binding_ConvexRect    3
#define DEF_binding_L2_Blur       4

#define DEF_binding_L3_ArrayImage   10
#define DEF_binding_L3_ArraySampler 11

#define DEF_binding_L4_LayerArea  7
#define DEF_binding_L4_SampleAA   9
#define DEF_binding_L4_TexID      10
#define DEF_binding_L4_TexArray   11
#define DEF_binding_L4_TexCube    12


#define DEF_TickMark_H   0
#define DEF_TickMark_V   1
#define DEF_TickMark_HV  2


/********************************* 2D 面着色类型 **********************************/

#define DEF_2DShaderType_Color           0		//纯色
#define DEF_2DShaderType_Stripe          1      //
#define DEF_2DShaderType_linearGradient  2      //线性渐变
#define DEF_2DShaderType_radialGradient  3      //径向渐变
#define DEF_2DShaderType_Checkerboard    4      //棋盘格
#define DEF_2DShaderType_AlphaStroke     5      //透明通道描边
#define DEF_2DShaderType_DepthStroke     6      //深度通道描边

#define DEF_2DCompositionType_None         0
#define DEF_2DCompositionType_Background   128
#define DEF_2DCompositionType_DoubleSided  64


#define DEF_VS_ShaderType_GazeMarker     1


#define DEF_2DShader_ElementType_Rect    0
#define DEF_2DShader_ElementType_Circle  1
#define DEF_2DShader_ElementType_Line    2



/********************************* 3D 面着色类型 **********************************/
#define DEF_3DShaderType_PerVertexColor       0
#define DEF_3DShaderType_PerObColor           1
#define DEF_FS_ShaderType_CirclePoint         2
#define DEF_3DShaderType_VertAddObColor       3
#define DEF_3DShaderType_FronWeight           4
#define DEF_3DShaderType_PerObCirclePoint     5




/********************************* 3D 面着色类型 **********************************/
#define DEF_3DTranform_Normal  0
#define DEF_3DTranform_LookAt  1



/********************************* 光追预定义 **********************************/

#define DEF_RenderFrameBindID			6
#define DEF_ParallelLightBindID			7

#define DEF_RayType             0
#define DEF_LigthRayType        1
//光线返回灯光
#define DEF_LigthReturnRayType  2
//光线返回环境
#define DEF_WorldReturnRayType  3





/********************************* 元素拾取属性 **********************************/
#define DEF_PickUp_LineDis       12
#define DEF_PickUp_LineMaxDis    1.0e+8






#ifdef __cplusplus

#include <basic_vec.h>

// GLSL Type
using uint = unsigned int;
using uint64_t = uint64;
using uint16_t =  uint16;


#define in
#define out
#define inout

#else

#extension GL_EXT_scalar_block_layout : enable
#extension GL_EXT_buffer_reference2 : require
#extension GL_EXT_shader_16bit_storage : require

#define Inline

#define EngineAPI_EXPORT 

//#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require

#endif

/**************************************** 基础类型 *******************************************/

struct svec2 {
	int16_t x;
	int16_t y;
};

struct suvec2 {
	uint16_t x;
	uint16_t y;
};




struct S_ParticleAttr {
	uint m_type_state;
	uint m_linkStart;
	uint m_linkCount;
	float m_life;
};

struct S_RtOb {
	//自定义物体实例属性指针和数量
	uint64_t	m_Address_InstanceAttrIndex;
	
	//S_ObMesh内存偏移
	uint	m_AddressMesh;
	uint	m_MaterialID;
	uint	m_InstanceID;

	uint	m_SceneMask_ObMask;
};

struct S_FaceAttr {
	uint MaterialID;
	uint MaterialSlot;
	uint Offset_MeshAttr;
	uint Offset_MaterialAttr;
};

struct S_Aabb {
	vec3 minimum;
	vec3 maximum;
	//int obType;
	//int matID;
};

struct S_BonesWeigth {
	uint BonesID;
	float Weigth;
};



struct S_Sphere {
	vec3 pos;
	float radius;
};

struct S_Ray2 {
	vec3 origin;
	vec3 direction;
};

struct S_TrackSample {
	uint64_t	m_Address_Point;
	uint		m_DataType;
	uint		m_SampleType;
	
	uint		m_SampleStart;
	uint		m_SampleLength;

	float		m_Start;
};

struct S_FrameSample_TAA {
	// - [0 - 0] - [层区域数量] - [层ID] - [采样累积计数]
	uint m_LayerAttr;

	// - [纵向偏移] - [横向偏移]
	uint m_LayerArea_Offset;
	// - [区域高度] - [区域宽度]
	uint m_LayerArea_Size;
};

struct S_2DConvexRect {
	vec2 offset;
	vec2 size;
	vec2 radius;
	// type:在纹理绘制 是纹理ID
	uvec2 AA_type;
};




/*************************************** 常量推送类型 ****************************************/

struct S_ConstPush_Waveform {
	uint m_Offset_Instance;
	uint m_Offset_Waveform;
	uint m_WaveformNum;
};

struct S_2DLine_PanelAttr {
	uint m_Offset_TranformG;
	uint m_Offset_TranformL;
	uint m_Offset_Color;
};

struct S_ConstPush_Texture {
	uint  m_Stretch_Mode;		//拉伸模式 0:填充 1:横向拉伸 2:纵向拉伸
	uint  m_Offset_TranformG;
	float x;
	float y;
	float m_Width_Size;
	float m_Hight_Size;
};

struct S_ConstPush_Textures {
	uint m_Offset_TranformG;
	uint m_Offset_TranformL;
	uint m_Offset_Rect;
	uint m_Offset_Color;
};

struct S_ConstPush_TickMark {
	uint m_Offset_TranformG;
	uint m_Offset_TranformL;
	uint m_Offset_Color;
	uint m_Dir;
	float ox;
	float oy;
	float w;
	float h;
	
};

struct S_ConstPush_2DPolygonElement {
	uint m_Offset_TranformG;
	uint m_Offset_TranformL;
	uint m_Offset_Color;
	uint m_Offset_Control;
};

struct S_2DConvexElement_PanelAttr {
	uint m_Offset_TranformG;
	uint m_Offset_TranformL;
	uint m_Offset_Color;
	uint m_Offset_Rect;
	//uint m_Offset_Control;
};

struct S_ConstPush_TAA {
	//uint  m_Frame_ID;	
	uint  m_Offset_TranformG;
	float x;
	float y;
	float m_Width_Size;
	float m_Hight_Size;

	uint m_LayerAttr;
	//float m_TexHight;
};

struct S_ConstPush_ImageComposition {
	uint m_LayerNum;
	uint m_SampleAcc;
	float m_SampleWidget;
};



struct S_ConstPush_Mesh_Face {
	uint m_Offset_Tranform;
	uint m_Offset_FaceColor;
	uint m_Ob_Color;
	uint m_Ob_ShaderType;
};

struct S_ConstPush_Mesh_Point {
	uint m_Offset_Tranform;
	uint m_Ob_ShaderType;
	uint m_Ob_Color;
	float m_PointSize;
};

struct S_ConstPush_Mesh_Line {
	uint m_Offset_Tranform;
	uint m_Ob_ShaderType;
	uint m_Ob_Color;
};

//刻度网格线 
struct S_ConstPush_Mesh_GraduationLine {
	uint m_Offset_Tranform;
	uint m_Ob_Color;
	uint m_Grid_HNum;
	float m_CellSize;
	float m_CellScale;
	float m_CameraDis;
};

struct S_ConstPush_Mesh_Bound {
	uint m_Offset_Tranform;
	uint m_Ob_Color;
	vec3 m_Size;
};

//struct S_ConstPush_RasterPostCompositing {
//	uvec2 m_resolutionRatio;
//	float m_radiusAO;
//	float m_shadowIntensity;
//	float m_depthBias;
//};

/**************************************** BVH *******************************************/

struct S_BVH_2d {
	vec2 position;
	vec2 boxSize;
	uint next_IndexOffset;
	uint next_IndexNum;
};


/**************************************** 材质属性 *******************************************/

struct S_GlobalAtt_RasterPostCompositing {
	mat4 m_ProjMatrix;
	vec3 m_cameraLoc;

	uvec2 m_resolutionRatio;
	float m_radiusAO;
	float m_intensityAO;
	float m_thicknessAO;
	float m_depthBias;

	float m_shadowIntensity;
	float m_envIntensity;

	float m_time;

	uint16_t m_AO_X_Sample;
	uint16_t m_AO_Y_Sample;

	uint16_t  m_shadowSampleNum;

	uint16_t light_Num;
	uint16_t light_Offset;

	uint16_t envTex_num;
	uint16_t envTexAtt_Offset;

	//uint16_t AreaLigth_Offset;
	//uint16_t AreaLigth_Num;
	
};

struct S_ConstPush_AmbientBlur {
	vec3 m_cameraLoc;

	uvec2 m_resolutionRatio;

	float m_blur;
	float m_blurSample;

};



struct EngineAPI_EXPORT S_Material {
	vec3	m_color;
	int     m_colorTex;

	vec3	m_emission;
	int		m_emissionTex;

	//高光
	vec3	m_specular;
	int		m_specularTex;

	//反射
	float m_reflect;
	int m_reflectTex;

	//折射
	float m_refract;
	int   m_refractTex;

	//粗糙度
	float m_roughness;
	int   m_roughnessTex;


	float m_alpha;
	int   m_alphaTex;


	float m_transmission;
	int   m_normalTex;


	float m_anisotropy;
	float m_overflowColor;


	int	 m_shaderIndex;
	uint m_LigthMask;


	uint64_t m_CustomAttrOffset;
};






#ifdef __cplusplus


#else


layout(buffer_reference, scalar) readonly buffer R_GlobalParameter_ParticleAttr { S_ParticleAttr  ParticleAttrPtr[]; };

layout(buffer_reference, scalar) readonly buffer B_RtOb { S_RtOb gRtOb[]; };
layout(buffer_reference, scalar) readonly buffer B_AABB { S_Aabb gAabb[]; };

vec3 f_quatRot(in vec3 pos, in vec4 q) {
	vec3 newPos;
	newPos = pos * (2.0f * q.w * q.w - 1.0f) - cross(q.xyz, pos) * q.w * 2.0f + q.xyz * dot(q.xyz, pos) * 2.0f;
	return newPos;
}

//void f_call_WorldRay(inout S_Ray hitValue, inout S_SceneDataCall callSceneData, in GLSL_RenderFrame renderFrame) {
//	callSceneData.rayDir = gl_WorldRayDirectionEXT;
//	callSceneData.MaterialID = 0;
//	callSceneData.PrimitiveIndex = 0;
//	callSceneData.InstanceIndex = 0;
//	callSceneData.Vert = gl_WorldRayDirectionEXT;
//	callSceneData.ligthDir = gl_WorldRayDirectionEXT;
//	callSceneData.Normal = -gl_WorldRayDirectionEXT;
//	callSceneData.Color = vec3(0);
//
//
//	executeCallableEXT(renderFrame.m_world_ShaderID, 3);
//
//	vec3 w = vec3(0.2125, 0.7154, 0.0721);
//	float luminance = max(dot(callSceneData.Color, w), 0) * 3;
//	hitValue.Color += callSceneData.Color;
//	hitValue.irradiance += luminance;
//}

#endif







/**************************************** 面 顶点 属性 *******************************************/

struct S_FaceElement {
	int  FacesMooth;	 //面平滑模式
	int  MaterialID;     //面材质ID
	int  MaterialSlot;   //
	int  ObType;         //物体类型
	uint FaceColor;
};

struct S_MeFaceElement {
	// 物体类型 面平滑模式
	uint  ObType_FacesMooth;	 //面平滑模式
	// 材质槽 面材质ID
	uint  MaterialSlot_MaterialID;     //面材质ID
	//面颜色
	uint FaceColor;
};

struct S_2D_EffectLinearGradient {
	uint	color;
	float	offset;
};

struct S_2D_EffectControl {
	vec2 c1;
	vec2 f1;
	float r;

	uint Offset_Point;
	uint fillType_pointNum;
	
};



struct S_GlobalParam {
	uint64_t m_AddressI32;
	uint64_t m_AddressUI32;
	uint64_t m_AddressF32;
	uint64_t m_AddressVec2;
	uint64_t m_AddressVec3;
	uint64_t m_AddressVec4;

	uint64_t m_AddressiVec2;
	uint64_t m_AddressiVec3;
	uint64_t m_AddressiVec4;

	uint64_t m_AddressUVec2;
	uint64_t m_AddressUVec3;
	uint64_t m_AddressUVec4;
	uint64_t m_AddressMat44;
	uint64_t m_AddressSampleCurve;

	uint64_t m_AddressLigthParallel;
	uint64_t m_AddressLigthPoint;
	uint64_t m_AddressLigthArea;
	uint64_t m_AddressLigthSpot;

	uint64_t m_AddressMaterial;



	uint64_t m_AddressCustomAttrP_I32;
	uint64_t m_AddressCustomAttrP_UI32;
	uint64_t m_AddressCustomAttrP_F32;
	uint64_t m_AddressCustomAttrP_Vec2;
	uint64_t m_AddressCustomAttrP_Vec3;
	uint64_t m_AddressCustomAttrP_Vec4;
	uint64_t m_AddressCustomAttrP_iVec2;
	uint64_t m_AddressCustomAttrP_iVec3;
	uint64_t m_AddressCustomAttrP_iVec4;

	uint64_t m_AddressCustomAttrF_I32;
	uint64_t m_AddressCustomAttrF_UI32;
	uint64_t m_AddressCustomAttrF_F32;
	uint64_t m_AddressCustomAttrF_Vec2;
	uint64_t m_AddressCustomAttrF_Vec3;
	uint64_t m_AddressCustomAttrF_Vec4;
	uint64_t m_AddressCustomAttrF_iVec2;
	uint64_t m_AddressCustomAttrF_iVec3;
	uint64_t m_AddressCustomAttrF_iVec4;

	uint64_t m_AddressInstanceMaterialID;

	//uint64_t m_Offset_LigthParallel;
	//uint64_t m_Offset_LigthPoint;
	//uint64_t m_Offset_LigthSpot;
	//uint64_t m_Offset_LigthArea;

	uint m_I32Num;
	uint m_UI32Num;
	uint m_F32Num;
	//uint m_F32Num;
	uint m_Vec2Num;
	uint m_Vec3Num;
	uint m_Vec4Num;

	uint m_iVec2Num;
	uint m_iVec3Num;
	uint m_iVec4Num;

	uint m_uVec2Num;
	uint m_uVec3Num;
	uint m_uVec4Num;



	uint m_Num_LigthParallel;
	uint m_Num_LigthPoint;
	uint m_Num_LigthSpot;
	uint m_Num_LigthArea;

};

struct S_ObMesh {
	uint64_t	m_AddressVertex;
	uint64_t	m_AddressUV;
	uint64_t	m_AddressUVIndex;
	uint64_t	m_AddressIndex;
	uint64_t	m_AddressFaces;

	//网格的自定义属性
	uint64_t	m_CustomAttrOffset;
	uint64_t	m_Face_AdjacencyID;
	uint64_t	m_Face_Normal;
	uint64_t	m_Face_Center;

	//uint64_t	m_Address_AABB;
	//物体的自定义属性
	//uint64_t	m_Address_InstanceAttrIndex;

	//纹理层数和内存偏移
	uvec3 uvLayerAndOffset;
	//相对于上一层UV的偏移
	uvec3 uvIndexOffset012;
	uvec3 uvIndexOffset345;
	uvec3 uvIndexOffset678;

	vec3 boundOffset;
	vec3 boundSize;


	uint		m_ObType;
	uint		m_ObDataID;
	uint		m_InstanceMaterialOffset;
	

	vec3		m_Location;


};


struct S_MulTex_ConstPush {
	uint MO_Tranform;
	uint MO_TextureID;
};



/**************************************** 灯光属性 *******************************************/
struct S_LightIndex {
	uint16_t m_lightType;

	uint16_t m_attIndex;
	uint16_t m_matrixIndex;
	uint16_t m_shadowTexIndex;
};

//struct S_LightAttIndex {
//	uint16_t m_matrixIndex;
//	uint16_t m_shadowIndex;
//};
       
struct S_LightParallel {
	vec3 m_dir;
	vec3 m_color;
	float m_intensity;
	float m_falloff;
	float m_diffusivity;
	uint m_mask;
	uint m_enable;

	float m_width;
	float m_hight;

	uint m_samplerNum;
};

struct S_LightPoint {
	vec3 m_pos;
	vec3 m_color;
	float m_intensity;
	float m_falloff;
	float m_size;
	uint m_mask;
	uint m_enable;
};

struct S_LightArea {
	vec3 m_pos;
	vec3 m_dir;
	vec3 m_color;
	float m_intensity;
	float m_falloff;
	float m_dis;
	float m_specular;

	float m_contactShadowLength;
	float m_thickness;
	//
	float m_diffusivity;
	uint m_mask;
	uint m_enable;

	float m_width;
	float m_height;
	uint m_samplerType_samplerNum;
};

struct S_LightSpot {
	vec3 m_dir;
	vec3 m_pos;
	vec3 m_color;
	float m_intensity;
	float m_falloff;
	//
	float m_diffusivity;
	uint m_mask;
	uint m_enable;

	uint m_samplerNum;
};



struct S_RenderDebug {
	uint Layer;
	uint Dir;
	float ComparisonRatio;
	float CameraDis;
};





#define DEF_ParticleState_disable 0
#define DEF_ParticleState_enable 1

#define DEF_ParticleType_fluid        1
#define DEF_ParticleType_inflow       2
#define DEF_ParticleType_rigidBody    3
#define DEF_ParticleType_flexibleBody 4
#define DEF_ParticleType_cloth        5
#define DEF_ParticleType_outflow      6
#define DEF_ParticleType_control      7
#define DEF_ParticleType_static       8
#define DEF_ParticleType_vehicle      9


#define DEF_ForceType_unidirectional   0
#define DEF_ForceType_radial           1
#define DEF_ForceType_rotate           2
#define DEF_ForceType_turbulence       3

#define DEF_ShapeType_sphere       0
#define DEF_ShapeType_cylinder     1
#define DEF_ShapeType_box          2




struct S_MPM_Grid_ConstPush {
	uint64_t	m_Address_weigth;
	uint64_t	m_Address_momentum;
	ivec3		m_dim;
};

struct S_MPM_PTM_ConstPush {
	uint64_t	m_Address_particle;
	uint64_t	m_Address_particle_mass;
	uint64_t	m_Address_particle_velocity;

	uint64_t	m_Address_weigth;
	uint64_t	m_Address_momentum;

	ivec3		m_dim;
	vec3		m_gridOffset;
	float		m_cellSize;
	float		m_dt;
};



struct S_PBF_ParticleGrid_ConstPush {
	uint64_t	m_Address_Particle;
	uint64_t	m_Address_OldParticle;
	uint64_t	m_Address_Velocity;
	uint64_t	m_Address_Acceleration;
	uint64_t	m_Address_Mass;
	
	uint64_t	m_Address_TypeState;
	uint64_t	m_Address_Delta;
	uint64_t	m_Address_IndexKey;
	uint64_t	m_Address_SimParam;

	uint64_t	m_Address_Force;


	//uint64_t	m_Address_KeyOffset;
	vec3		m_min_bound;
	vec3		m_max_bound;

	vec3		m_gridOffset;
	ivec3		m_dim;
	float		m_cellSize;
	uint		m_particleCount;
	uint		m_forceCount;
};

struct S_PBF_ParticleForce_ConstPush {
	uint64_t	m_Address_Particle;
	uint64_t	m_Address_OldParticle;
	uint64_t	m_Address_Acceleration;
	uint64_t	m_Address_Velocity;
	uint64_t	m_Address_Mass;
	uint64_t	m_Address_Delta;
	uint64_t	m_Address_IndexKey;
	uint64_t	m_Address_KeyOffset;
	uint64_t	m_Address_Grid;
	uint64_t	m_Address_SimParam;

	uint64_t	m_Address_RtOb;
	
	vec3		m_min_bound;
	vec3		m_max_bound;

	ivec3		m_dim;
	float		m_cellSize;
	float		m_dt;
	uint		m_particleCount;
	uint		m_CollisionMeshNum;
};

struct S_PBF_RadixSort_ConstPush {
	uint64_t	m_Address_IndexKey;
	uint64_t	m_Address_KeyOffset_a;
	uint64_t	m_Address_KeyOffset_b;
	uint64_t	m_Address_KeyCount;
	uint64_t	m_Address_isSwap;

	ivec3		m_dim;
	uint		m_Bit;
	uint		m_particleCount;
};

struct S_PBF_MapRange_ConstPush {
	uint64_t	m_Address_KeyOffset_a;
	uint64_t	m_Address_KeyOffset_b;

	uint		m_Bit;
	uint		m_groupCount;
};

struct S_PBF_CombiningSort_ConstPush {
	uint64_t	m_Address_IndexKey_a;
	uint64_t	m_Address_IndexKey_b;
	uint64_t	m_Address_KeyOffset;
	uint64_t	m_Address_KeyCount;

	uint		m_offset_a;
	uint		m_offset_b;
	uint		m_secondStart_b;
	uint		m_particleCount;

};



//=============================== 飞溅粒子 =================================
struct S_PBF_DiffuseCombining_ConstPush {
	uint64_t	m_Address_Acceleration;
	uint64_t	m_Address_Mass;
	uint64_t	m_Address_SplashLifetime;

	uint64_t	m_Address_IndexKey_a;
	uint64_t	m_Address_IndexKey_b;
	uint64_t	m_Address_KeyOffset_a;
	uint64_t	m_Address_KeyOffset_b;
	uint64_t	m_Address_KeyCount;

	uint64_t	m_Address_SimParam;

	ivec3		m_dim;
	float		m_radius;
	uint		m_Bit;
	uint		m_particleCount;
};

struct S_PBF_GenDiffuse_ConstPush {
	uint64_t	m_Address_Particle;
	uint64_t	m_Address_Acceleration;
	//uint64_t	m_Address_Mass;
	uint64_t	m_Address_IndexKey;
	uint64_t	m_Address_Grid;
	
	
	uint64_t	m_Address_SplashIndexKey;
	uint64_t	m_Address_SplashParticle;
	uint64_t	m_Address_SplashAcceleration;
	uint64_t	m_Address_SplashLifetime;
	uint64_t	m_Address_SimParam;

	vec3		m_min_bound;
	vec3		m_max_bound;

	ivec3		m_dim;
	vec3		m_gridOffset;
	float		m_dt;
	float		m_cellSize;
	uint		m_particleCount;
	uint		m_particleOffset;
	uint		m_particleReuse;

};

struct S_PBF_DiffuseEmission_ConstPush {
	uint64_t	m_Address_SplashLifetime;
	uint64_t	m_Address_KeyCount;

	uint64_t	m_Address_IndexKey_a;
	uint64_t	m_Address_IndexKey_b;
	uint64_t	m_Address_KeyOffset_a;
	uint64_t	m_Address_KeyOffset_b;
	uint64_t	m_Address_Value_a;
	uint64_t	m_Address_Value_b;
	uint64_t	m_Address_isSwap;

	uint64_t	m_Address_SimParam;

	ivec3		m_dim;
	float		m_radius;
	uint		m_Bit;
	uint		m_particleCount;
	uint		m_secondStart_b;
};




struct S_PBF_ParticleDEBUG_ConstPush {
	uint64_t	m_Address_Particle;
	uint64_t	m_Address_Acceleration;
	uint64_t	m_Address_SplashIndexKey;

	uint64_t	m_Address_Vert;

	ivec3		m_dim;
	float		m_cellSize;
	float		m_density;
	uint		m_particleCount;
	//uint		m_splashOffset;
};

struct S_PBF_DomainDEBUG_ConstPush {
	uint64_t	m_Address_Grid;
	uint64_t	m_Address_Vert;
	
	ivec3		m_dim;
	vec3		m_gridOffset;
	float		m_cellSize;
};


//=================================== 物理力 ==================================

struct S_PBF_force {
	vec4	m_dir;
	vec3	m_point;
	
	//半径限制
	vec2	m_limitsR;
	//高度限制
	vec2	m_limitsH;

	float	m_intensity;

	//float	m_noise;

	uint	m_type_limits;
};




//=================================== 笔刷 ==================================
struct S_Brush_Maobi {
	uint texID;

	uint point;
	uint dir;
	//倾斜 f32
	uint tilt;
	//压力 f32
	uint pressure;
	//墨量
	uint ink;
	//半径
	uint radius;
};

struct S_Brush_Monochrome {
	vec4 colorA;
	vec4 colorB;
	uint texID;
};




//=================================== 网格 ==================================

struct S_Polygon_Triangles {
	uint offset_index;
	uint offset_texCoord[8];
	uint offset_face;

	uint offset_polygonVert;
	uint offset_polygonIndex;
	uint offset_polygonFace;
	
	//uint offset_
	uint texCoordNum;
};

struct S_Polygon_Face {
	uint offset_vertIndex;
	uint vertNum;
	uint offset_uvLoopIndex;
	uint uvLoopNum;
};


#endif



